package com.example.springbootmybatisdemo.mapper;

import com.example.springbootmybatisdemo.UserPo;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author xm, huangwei@rjhc.com
 * @version 1.3
 * @description
 * @Copyright 2022- 北京融嘉合创科技有限公司 All rights reserved.
 * @since 2022.04.24
 */
@Mapper
public interface UserMapper {

    @Insert("insert into user(`name`,`age`) values (#{params.name},#{params.age})")
    Boolean save(@Param("params") UserPo po);

    @Update("update user set name=#{params.name} where id=#{params.id}")
    Boolean update(@Param("params") UserPo userPo);

    @Delete("delete from user where id = #{id}")
    Boolean deleteById(UserPo userPo);

    @Select("select * from user")
    List<UserPo> findAll();

}
